'''
Description: 
Version: 1.0.1
Autor: hrlu.cn
Date: 2022-02-27 20:23:06
LastEditors: hrlu.cn
LastEditTime: 2023-01-29 14:02:12
'''
from processor.crawler import *
from processor.functions import *

from monitor.task_args import *

TASKS = {
    'update_tushare_basic': {
        'desp': "更新 Tushare 源", 
        # pro_bar > 2000
        'func': TushareAPI.update_all_stock_basic,
        'args': BASIC_ARGS + PROGRESS_ARGS,
    },
    'update_daily_rsi': {
        'desp': "计算 Tushare RSI [日级]",
        'func': TushareAPI.update_all_stock_rsi,
        'args': PROGRESS_ARGS,
    },
    'update_weekly_rsi': {
        'desp': "计算 Tushare RSI [周级]",
        'func': TushareAPI.update_weekly_all_stock_rsi,
        'args': PROGRESS_ARGS,
    },
    'update_tushare_rsi': {
        'desp': "更新 Tushare 官方RSI [日级]",
        'func': TushareAPI.update_tushare_rsi,
        'args': BASIC_ARGS + PROGRESS_ARGS,
    },
    'update_all_stock_fresh_price': {
        'desp': "计算股价新高",
        'func': TushareAPI.update_all_stock_fresh_price,
        'args': PROGRESS_ARGS,
    },

    'update_top10_holder': {
        'desp': "更新十大流通股东",
        # top10_holders
        'func': TushareAPI.update_all_stock_top10_holder,
        'args': PROGRESS_ARGS,
    },
    'update_holder_number': {
        'desp': "更新股东户数",
        # stk_holdernumber > 5000, 
        'func': TushareAPI.update_all_stock_holder_number,
        'args': PROGRESS_ARGS,
    },
    'update_stock_achievement': {
        'desp': "更新业绩筛选",
        # income_vip > 2000, fina_indicator_vip > 5000
        'func': TushareAPI.update_all_stock_achievement,
        'args': PERIOD_ARGS + PROGRESS_ARGS,
    },
    'update_stock_forecast': {
        'desp': "更新业绩预告",
        # forecast_vip > 5000 , daily_basic > 2000
        'func': TushareAPI.update_all_stock_forecast,
        'args': PERIOD_ARGS + PROGRESS_ARGS,
    },
    'update_stock_forecast': {
        'desp': "更新公募基金持股", 
        # fund_portfolio > 5000, fund_basic > 2000, fund_share > 2000, daily_basic > 2000
        'func': TushareAPI.update_all_stock_fund_portfolio,
        'args': PERIOD_ARGS + PROGRESS_ARGS,
    },
    'update_all_stock_consensus_forecasts': {
        'desp': "更新一致预测", 
        # report_rc > 8000, income_vip > 5000
        'func': TushareAPI.update_all_stock_consensus_forecasts,
        'args': PROGRESS_ARGS,
    },
    'update_daily_stock_conceptual': {
        'desp': "更新概念分类日级统计", 
        # moneyflow > 2000, daily_basic > 2000
        'func': TushareAPI.update_daily_stock_conceptual,
        'args': PROGRESS_ARGS,
    },
    'update_all_stock_conceptual': {
        'desp': "更新概念分类季度统计", 
        # ths_index > 5000, ths_member > 5000
        'func': TushareAPI.update_all_stock_conceptual,
        'args': PERIOD_ARGS + PROGRESS_ARGS,
    },
    
    'execute_tushare_macross': {
        'desp': "执行 Tushare 交叉筛选",
        'func': MACross.ts_sch_pcs,
        'args': BASIC_ARGS + PROGRESS_ARGS,
    },
    'execute_rsi_extremum': {
        'desp': "执行 RSI 极值监控",
        'func': RSIFilter.ext_pcs,
        'args': PROGRESS_ARGS,
    },
    'execute_rsi_structure': {
        'desp': "执行 RSI 每日数据分析",
        'func': RSIFilter.dly_pcs,
        'args': PROGRESS_ARGS,
    },
    'execute_rsi_trend': {
        'desp': "执行 RSI 趋势判断",
        'func': RSIFilter.prd_pcs,
        'args': PROGRESS_ARGS,
    },
    # 'execute_wind_macross': {
    #     'desp': "执行 Wind 交叉筛选",
    #     'func': MACross.wd_sch_pcs,
    # },
    # 'update_wind_basic': {
    #     'desp': "更新 Wind 源",
    #     'func': WindAPI.update_all_stock_basic,
    # },
    # 'update_wind_wbasic': {
    #     'desp': "更新 Wind 周级 源",
    #     'func': WindAPI.update_all_stock_wbasic,
    # },
    # 'update_rsi': {
    #     'desp': "更新 Wind RSI",
    #     'func': WindAPI.update_all_stock_rsi,
    # },
    # 'update_wrsi': {
    #     'desp': "更新 Wind 周级 RSI",
    #     'func': WindAPI.update_all_stock_wrsi,
    # },
    # 'connect_wind': {
    #     'desp': "连接至 Wind 服务器",
    #     'func': WindAPI.connect,
    # },
}
